package com.mm.common.utils.theadPoolUtil;


import com.mm.common.utils.theadPoolUtil.strategy.error.IErrorStrategy;

/**
 * @Program: 8.mindmap
 * @Author: 海里的鱼
 * @Create: 2024-08-26 09:01
 * @Name: 任务工具类
 * @Desc: TODO
 */
public class BulkExecuteUtil {

    public static <T extends BulkTask> BulkExecuteHandler<T> getHandler(BulkTaskCollection<T> taskCollection){
        return new BulkExecuteHandler<T>(taskCollection);
    }

    public static BulkExecuteHandler getHandler(){
        return new BulkExecuteHandler();
    }

    public static <T extends BulkTask> BulkExecuteHandler<T> getHandler(BulkTaskCollection<T> taskCollection,IErrorStrategy strategy){
        BulkExecuteHandler<T> handler = new BulkExecuteHandler<T>(taskCollection);
        handler.setErrorStrategy(strategy);
        return handler;
    }

    public static BulkExecuteHandler getHandler(IErrorStrategy strategy){
        BulkExecuteHandler handler = new BulkExecuteHandler();
        handler.setErrorStrategy(strategy);
        return handler;
    }

    public static <T extends BulkTask> BulkTaskCollection<T> getTaskCollection(Class<T> classType){
        return new BulkTaskCollection<T>();
    }

}
